package jjn.round2;

/**
 * @author Jiang Jining
 * @since 2023-05-03 14:47
 */
public class Offer11_MinArray {
    public int minArray(int[] numbers) {
        int left = 0, right = numbers.length - 1;
        while (left <= right) {
            int mid = (right - left) / 2 + left;
            if (numbers[mid] > numbers[right]) {
                left = mid + 1;
                continue;
            }
            if (numbers[mid] < numbers[right]) {
                right = mid;
                continue;
            }
            right--;
        }
        return numbers[left];
    }
}
